import service from "@/utils/request";


// 查询用户管理分组
export function structure() {
  return service({
    url: "/xinfa-service/v1/sys-organization-structure/",
    method: "get",
  });
}
// 添加用户管理分组
export function AddStructure(data:any) {
    return service({
        url: "/xinfa-service/v1/sys-organization-structure",
        method: "post",
        data
      });
  }
//   修改用户管理分组
export function EditStructure(data:any) {
    return service({
        url: "/xinfa-service/v1/sys-organization-structure",
        method: "put",
        data
      });
  }
// 删除用户管理分组
export function DelectStructure(id:any) {
    return service({
        url: "/xinfa-service/v1/sys-organization-structure/" + id,
        method: "delete",
      });
  }
//   用户表分页
export function uderPage(data:{
    pageNum:any,
    pageSize:any,
    groupId:any,
    roleId:any,
    usable:any,
    keyword:any
}) {
    return service({
        url: "/oauth-service/v1/sys-user/page?pageNum=" + data.pageNum + '&pageSize='+data.pageSize + '&groupId='+data.groupId + '&roleId='+data.roleId	+'&usable='+data.usable +'&keyword='+data.keyword,
        method: "get",
      });
  }

//   角色列表
export function rolePage() {
    return service({
        url: "/oauth-service/v1/sys-role/",
        method: "get",
      });
  }
  //   新增子账户
export function AddProgramUser(data:any) {
    return service({
        url: "/oauth-service/v1/sys-user",
        method: "post",
        data
      });
  }
// 修改账户
export function editProgramUser(data:any) {
  return service({
      url: "/oauth-service/v1/sys-user",
      method: "put",
      data
    });
}
  // 账户详情
  export function editUser(id:any) {
    return service({
        url: "/oauth-service/v1/sys-user/" + id,
        method: "get",
      });
  }
  // 批量暂停
  export function batchPause(data:any) {
    return service({
        url: "/oauth-service/v1/sys-user/batch-pause",
        method: "post",
        data
      });
  }
    // 批量启用
    export function batchActivation(data:any) {
      return service({
          url: "/oauth-service/v1/sys-user/batch-activation",
          method: "post",
          data
        });
    }
      // 获取用户关联的菜单
  export function sysMenu(data:{linkSystem:any,account:any}) {
    return service({
        url: "/oauth-service/v1/sys-menu/getUserLinkMenu?linkSystem=" + data.linkSystem+'&account='+data.account,
        method: "get",
      });
  }
  // 获取所有的菜单
  export function AllsysMenu(data:{linkSystem:any}) {
    return service({
        url: "/oauth-service/v1/sys-menu/?linkSystem=" + data.linkSystem,
        method: "get",
      });
  }

      // 新增角色或者修改角色 
      export function roleLink(data:any) {
        return service({
            url: "/oauth-service/v1/sys-role/role-link-menu",
            method: "post",
            data
          });
      }
      // 角色列表
      export function GetsysMenu(data:{linkSystem:any}) {
        return service({
            url: "/oauth-service/v1/sys-role/?linkSystem="+ data.linkSystem,
            method: "get",
          });
      }
      // 删除角色表
      export function DelectProgramMenu(id:any) {
        return service({
            url: "/oauth-service/v1/sys-role/"+ id,
            method: "delete",
          });
      }
      // 获取角色关联的菜单
      export function GetOpensysMenu(roleId:any) {
        return service({
            url: "/oauth-service/v1/sys-role/role-menu?roleId="+ roleId,
            method: "get",
          });
      }